
// let nickname = '四营的姑娘' ;

// 执行器接受两个函数作参数
let executor = function( resolve , reject ){
    try{
        console.log( nickname );
        resolve( '已兑现' );
    } catch ( error ) {
        console.log( error.name , error.message );
        reject( '已拒绝' );
    }
}

// 创建 Promise 实例时必须通过参数指定一个 执行器(executor)
let p = new Promise( executor );

let resolve = function(...params){
    console.log( 'resolved' , ...params );
}
let reject = function(...params){
    console.log( 'rejected' , ...params );
}

p.then( resolve , reject );